﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

            scrollWaveView1.WaveStream = new NAudio.Wave.WaveFileReader("E:\\Qsync\\音声認識\\wavefiles2\\F043-0.wav");
            mainWaveView1.WaveStream = scrollWaveView1.WaveStream;

            if (scrollWaveView1.WaveStream != null)
            {
                long samples = scrollWaveView1.Samples;
                //custom
                //mainWaveView1
                //scrollWaveView1.SamplesPerPixcel = (int)samples / this.Width;
            }
        }
        private void scrollWaveView_OnWaveScrolled (object sender, ScrollWaveView.WaveScrollEventArgs e)
        {
            //MessageBox.Show("scroll");
        }
        private void Form1_SizeChanged(object sender, EventArgs e)
        {
            //if (scrollWaveView.WaveStream != null)
            //{
            //    long samples = scrollWaveView.Samples;
            //    scrollWaveView.SamplesPerPixel = (int)samples / this.Width;
            //}

        }

        private void customWaveView1_Load(object sender, EventArgs e)
        {

        }

        private void scrollWaveView_Load(object sender, EventArgs e)
        {
            
        }

        private void mainWaveView1_Load(object sender, EventArgs e)
        {

        }

        private void waveformPainter1_Click(object sender, EventArgs e)
        {

        }

        private void scrollWaveView1_OnWaveScrolled(object sender, ScrollWaveView.WaveScrollEventArgs e)
        {
            mainWaveView1.StartPosition = e.SamplePosition;
            mainWaveView1.Invalidate();
            toolStripStatusLabel1.Text = "" + mainWaveView1.Samples;
            toolStripStatusLabel2.Text = "" + scrollWaveView1.GrabPosition;
            toolStripStatusLabel3.Text = "" + scrollWaveView1.Samples;
        }

        private void toolStripStatusLabel1_Click(object sender, EventArgs e)
        {

        }
    }
}
